package com.dandelion.commons.repository;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

public interface BaseMapper<T> {
	
	int deleteByPrimaryKey(Long id);
	
    int insert(T record);

    int insertSelective(T record);

    int updateByPrimaryKeySelective(T record);

    int updateByPrimaryKey(T record);
    
    T selectByPrimaryKey(Long id);
    
    T selectOne(@Param("record") T record) ;

    int deleteByPrimaryKeys(Long[] ids);
    
	List<T> selectAllList(@Param("record") T record) ;
    
	int getCount(Map<String, Object> recordMap);
	
	List<T> selectAllListPage(Map<String, Object> recordMap) ;
	
	/**
	 * 检查字段的值是否已存在
	 * @param id ID可以为NULL，主要用于update操作
	 * @param field coulum名
	 * @param fieldVal column值
	 * @return
	 */
	int existsFileldValue(@Param("id") Long id, @Param("field") String field, @Param("fieldVal") String fieldVal) ;
	
}
